let path = require('path')
class P {
    apply(compiler) {
        console.log('start')
        compiler.hooks.emit.tap('emit', function() {
            console.log('emit')
        })
    }
}

module.exports = {
    mode: 'development',
    entry: './src/index.js',
    output: {
        filename: 'bundle.js',
        path: path.resolve(__dirname, 'dist')
    },
    resolveLoader: {
        // alias: {
        //     styleLoader: path.resolve(__dirname, './src/loader', 'style-loader'),
        //     cssLoader: path.resolve(__dirname, './src/loader', 'less-loader')
        // }
        modules: ['node_modules', path.resolve(__dirname, 'loaders')]
    },
    module: {
        rules: [
            {
                test: /\.less$/,
                use: [
                    // styleLoader,
                    path.resolve(__dirname, './src/loader', 'style-loader'),
                    // cssLoader
                    path.resolve(__dirname, './src/loader', 'less-loader')
                ]
            }
        ]
    },
    plugins: [
        new P()
    ]
}

